<template>
  <!-- 面试技巧详情 -->
  <div class="technicDetail">
    <!-- 头部 -->
    <div class="head">
      <i class="iconfont iconbtn_nav_back" @click="rollback"></i>
    </div>
    <!-- title -->
    <div class="title">
      <h3>{{ detail.title }}</h3>
    </div>
    <!-- 其它 -->
    <div class="other">
      <div class="time">{{ detail.updated_at | formaTime }}</div>
      <div class="right">
        <div class="see">
          <i class="iconfont iconicon_liulanliang"></i>
          <span>{{ detail.read }}</span>
        </div>
        <div class="like">
          <i class="iconfont iconicon_dianzanliang"></i>
          <span>{{ detail.star }}</span>
        </div>
      </div>
    </div>
    <div v-html="detail.content" class="content"></div>
  </div>
</template>

<script>
import { articlesTechnicDetail } from '@/api/api.js'
import moment from 'moment'
export default {
  data () {
    return {
      id: this.$route.params.id,
      detail: {}
    }
  },
  methods: {
    rollback () {
      this.$router.go(-1)
    },
    async getDetail () {
      const res = await articlesTechnicDetail(this.id)
      this.detail = res.data
    }
  },
  created () {
    this.getDetail()
  },
  filters: {
    formaTime (val) {
      return moment(val).format('YYYY-MM-DD')
    }
  }
}
</script>

<style lang="less">
.technicDetail {
  .head {
    position: relative;
    width: 100%;
    height: 46px;
    line-height: 46px;
    padding: 0 10px;
    border-bottom: 1px solid #ebedf0;
    i {
      position: absolute;
      top: 0;
      left: 5px;
      font-size: 46px;
      color: #000;
    }
  }
  .title {
    margin-top: 20px;
    padding: 0 15px;
    h3 {
      font-weight: normal;
      font-size: 18px;
    }
  }
  .other {
    padding: 0 15px;
    font-size: 10px;
    color: #b4b4bd;
    display: flex;
    line-height: 18px;
    justify-content: space-between;
    .right {
      width: 100px;
      display: flex;
      .see {
        flex: 1;
        text-align: center;
        position: relative;
        i {
          position: absolute;
          top: 0;
          left: -10px;
        }
      }
      .like {
        flex: 1;
        text-align: right;
        position: relative;
        i {
          position: absolute;
          top: 0;
          left: 24px;
        }
      }
    }
  }
  .content {
    padding: 0 15px;
    p {
      font-size: 16px;
    }
    img {
      width: 100%;
    }
  }
}
</style>
